<?php
namespace app\web\model;

use app\lib\exception\TokenException;
/**
 * @package app\basic\model
 */
class Blacklist extends Common 
{
    public static function checkOrder($order)
    {
        $res = self::where(['mobile'=>$order['mobile'],'technician_id'=>$order['technician_id']])->find();
        if($res) {
            throw new TokenException(['code'=>400,'msg'=>'你已被拉黑,不可预约']);
        }
        if($order['shop_id'] > 0){
            $res = self::where(['mobile'=>$order['mobile'],'shop_id'=>$order['shop_id']])->find();
            if($res) {
                throw new TokenException(['code'=>400,'msg'=>'你已被拉黑,不可预约']);
            }
        }
        return true;
    }
}
